#ifndef __WIZ_BNF_CONTEXT_HPP__SHANHAOBO_19800429__
#define __WIZ_BNF_CONTEXT_HPP__SHANHAOBO_19800429__

namespace Wiz
{
    namespace BNF
    {
        namespace Context
        {
            namespace Base
            {
                struct Type
                {};
            } /// end of namespace Base

            namespace Default
            {
                struct Type
                {
                    template <typename DerivedT>
                    struct AUX
                    {};
                };
            } /// end of namespace Default

            namespace Linker
            {
                template<typename ContextT>
                struct Type : public ContextT
                {
                    template <typename ParserT>
                    Type(ParserT const& Prs) : ContextT(Prs)
                    {}

                    template <typename ParserT, typename ScannerT>
                    ::Wiz::Void::Type PreParse(ParserT const& Prsr, ScannerT const& Scan)
                    {
                        ContextT::PreParse(Prsr, Scan);
                    }

                    template <typename ResultT, typename ParserT, typename ScannerT>
                    ResultT& PostParse(ResultT& Hit, ParserT const& Prsr, ScannerT const& Scan)
                    {
                        return ContextT::PostParse(Hit, Prsr, Scan);
                    }
                };
            } /// end of namespace Linker

            namespace AUX
            {
                template <typename ContextT, typename DerivedT>
                struct Type : public ContextT::tSuper::template AUX<DerivedT> 
                {};
            } /// end of namespace AUX

            template<typename AttributeT = ::Wiz::Null::Type>
            struct Type : public ::Wiz::BNF::Context::Base::Type
            {
                typedef AttributeT                                              tAttribute;
                typedef ::Wiz::BNF::Context::Default::Type                      tSuper;
                typedef ::Wiz::BNF::Context::Linker::Type<Type<tAttribute>>     tContextLinker;

                template <typename ParserT>
                Type(ParserT const&)
                {}

                template <typename ParserT, typename ScannerT>
                ::Wiz::Void::Type PreParse(ParserT const&, ScannerT const&)
                {}

                template <typename ResultT, typename ParserT, typename ScannerT>
                ResultT& PostParse(ResultT& Hit, ParserT const&, ScannerT const&)
                {
                    return Hit;
                }
            };
        } /// end of namespace Context
    } /// end of namespace BNF
} /// end of namespace Wiz

#endif /*__WIZ_BNF_CONTEXT_HPP__SHANHAOBO_19800429__*/
